<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>封装一个ajax 简单的库</title>
<link rel="stylesheet" href="css/base.css" />
<script type="text/javascript" src="js/ajax.js" ></script>
</head>
<body>
<div class="wrap">
	<h2 class="wrap-h2">javascript 小白的成长之路！</h2>
	<div class="wrap-main">
		<input id="btn1" type="button" value="请求ajax">
	</div>
</div>
<script type="text/javascript">
	window.onload = function (){
		var oBtn1 = document.getElementById("btn1");
		oBtn1.onclick = function (){
			ajax("json/addajax.json",function(str){
				var d = JSON.parse(str);
				console.log(d);
				alert("调用成功！")
			})
		}
	}
</script>
</body>
</html>
